package org.achartengine.internal.chart;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import java.util.ArrayList;
import java.util.List;
import org.achartengine.internal.renderer.XYMultipleSeriesRenderer;

/* loaded from: classes2.dex */
public abstract class k extends a {
    private static final long serialVersionUID = 1;
    private float a;
    private float b;
    private Rect c;
    protected org.achartengine.internal.model.g d;
    protected XYMultipleSeriesRenderer e;
    protected PointF f;
    XYMultipleSeriesRenderer.Orientation g;
    private double[] h;
    private int i;
    private int j;
    private int k;
    private boolean l;

    private void a(Canvas canvas, float f, boolean z) {
    }

    public abstract void a(Canvas canvas, Paint paint, float[] fArr, org.achartengine.internal.renderer.b bVar, float f, int i);

    public boolean a(org.achartengine.internal.renderer.b bVar) {
        return false;
    }

    public i a_() {
        return null;
    }

    public double b() {
        return Double.MAX_VALUE;
    }

    public abstract String c();

    /* JADX INFO: Access modifiers changed from: protected */
    public k() {
        this.h = new double[4];
        this.i = 4;
        this.j = 4 + 10;
        this.k = 60;
    }

    public k(org.achartengine.internal.model.g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        this.h = new double[4];
        this.i = 4;
        this.j = 4 + 10;
        this.k = 60;
        this.d = gVar;
        this.e = xYMultipleSeriesRenderer;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public void a(org.achartengine.internal.model.g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        this.d = gVar;
        this.e = xYMultipleSeriesRenderer;
    }

    /* JADX WARN: Removed duplicated region for block: B:156:0x0691  */
    /* JADX WARN: Removed duplicated region for block: B:162:0x06ce  */
    /* JADX WARN: Removed duplicated region for block: B:163:0x06f9  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x0733  */
    /* JADX WARN: Removed duplicated region for block: B:190:0x0883  */
    /* JADX WARN: Removed duplicated region for block: B:207:0x095f  */
    /* JADX WARN: Removed duplicated region for block: B:216:0x0a37  */
    /* JADX WARN: Removed duplicated region for block: B:217:0x0a59  */
    /* JADX WARN: Removed duplicated region for block: B:223:0x0a9b  */
    /* JADX WARN: Removed duplicated region for block: B:229:0x0ae0  */
    /* JADX WARN: Removed duplicated region for block: B:231:0x0ae3  */
    /* JADX WARN: Removed duplicated region for block: B:254:? A[RETURN, SYNTHETIC] */
    @Override // org.achartengine.internal.chart.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void a(android.graphics.Canvas r55, int r56, int r57, int r58, int r59, android.graphics.Paint r60) {
        /*
            Method dump skipped, instructions count: 2795
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: org.achartengine.internal.chart.k.a(android.graphics.Canvas, int, int, int, int, android.graphics.Paint):void");
    }

    private List<Double> a(List<Double> list) {
        ArrayList arrayList = new ArrayList(list);
        for (Double d : list) {
            if (d.isNaN()) {
                arrayList.remove(d);
            }
        }
        return arrayList;
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public void a(org.achartengine.internal.model.h hVar, Canvas canvas, Paint paint, List<Float> list, org.achartengine.internal.renderer.b bVar, float f, int i, XYMultipleSeriesRenderer.Orientation orientation) {
        i a_;
        float[] b = org.achartengine.internal.b.a.b(list);
        a(canvas, paint, b, bVar, f, i);
        if (a(bVar) && (a_ = a_()) != null) {
            a_.a(canvas, paint, b, bVar, f, i);
        }
        paint.setTextSize(this.e.R());
        if (orientation == XYMultipleSeriesRenderer.Orientation.HORIZONTAL) {
            paint.setTextAlign(Paint.Align.CENTER);
        } else {
            paint.setTextAlign(Paint.Align.LEFT);
        }
        if (this.e.Q()) {
            a(canvas, hVar, paint, b, i);
        }
    }

    protected void a(Canvas canvas, org.achartengine.internal.model.h hVar, Paint paint, float[] fArr, int i) {
        for (int i2 = 0; i2 < fArr.length; i2 += 2) {
            a(canvas, a(hVar.c(i2 / 2)), fArr[i2], fArr[i2 + 1] - 3.5f, paint, 0.0f);
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public void a(Canvas canvas, String str, float f, float f2, Paint paint, float f3) {
        float f4 = (-this.e.w().getAngle()) + f3;
        if (f4 != 0.0f) {
            canvas.rotate(f4, f, f2);
        }
        canvas.drawText(str, f, f2, paint);
        if (f4 != 0.0f) {
            canvas.rotate(-f4, f, f2);
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public String a(double d) {
        if (d == Math.round(d)) {
            return Math.round(d) + "";
        }
        return d + "";
    }

    /* JADX WARN: Removed duplicated region for block: B:48:0x0203  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0216  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    protected void a(java.util.List<java.lang.Double> r26, java.lang.Double[] r27, android.graphics.Canvas r28, android.graphics.Paint r29, int r30, int r31, int r32, double r33, double r35) {
        /*
            Method dump skipped, instructions count: 603
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: org.achartengine.internal.chart.k.a(java.util.List, java.lang.Double[], android.graphics.Canvas, android.graphics.Paint, int, int, int, double, double):void");
    }

    public XYMultipleSeriesRenderer e() {
        return this.e;
    }

    public org.achartengine.internal.model.g f() {
        return this.d;
    }

    public double[] g() {
        return this.h;
    }

    public double[] c(float f, float f2) {
        double C = this.e.C();
        double E = this.e.E();
        double G = this.e.G();
        double I = this.e.I();
        double d = f - this.c.left;
        Double.isNaN(d);
        double d2 = d * (E - C);
        double width = this.c.width();
        Double.isNaN(width);
        double height = (this.c.top + this.c.height()) - f2;
        Double.isNaN(height);
        double height2 = this.c.height();
        Double.isNaN(height2);
        return new double[]{(d2 / width) + C, ((height * (I - G)) / height2) + G};
    }

    public double[] a(double[] dArr) {
        double C = this.e.C();
        double E = this.e.E();
        double G = this.e.G();
        double I = this.e.I();
        double width = this.c.width();
        Double.isNaN(width);
        double d = this.c.left;
        Double.isNaN(d);
        double height = this.c.height();
        Double.isNaN(height);
        double d2 = this.c.top;
        Double.isNaN(d2);
        return new double[]{(((dArr[0] - C) * width) / (E - C)) + d, (((I - dArr[1]) * height) / (I - G)) + d2};
    }
}
